﻿using GraphQL;
using GraphQL.Types;
using Microsoft.Extensions.Options;
using NetCore_GraphQL.Entity;
using NetCore_GraphQL.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace NetCore_GraphQL.GraphType.Mutation
{
    public class SysInfoMutation : ObjectGraphType
    {
        private readonly SysInfoService _sysInfoService = new SysInfoService();
        public SysInfoMutation()
        {
            Name = "sysInfoMutation";
            Description = "扩展操作";
            Field<SysInfoType>("addSysInfo",
                arguments: new QueryArguments(new QueryArgument<InputSysInfoType> { Name = "sysInfo" }),
                resolve: x =>
                {
                    var addInfo = x.GetArgument<SysInfo>("sysInfo");
                    return _sysInfoService.Add(addInfo);
                });
        }
    }
}
